﻿CREATE FUNCTION [dbo].[MaxDate] (@a datetime,@b datetime)  
RETURNS datetime WITH SCHEMABINDING AS  
BEGIN 
RETURN(
SELECT MAX(v) FROM(SELECT @a v UNION SELECT @b)T
)
END


